#ifndef CF_DEFINITIONS_H
#define CF_DEFINITIONS_H

#include "CL_Definitions.h"
#include <QString>

#ifdef QT_NO_DEBUG
	#define CF_ASSERT(condition, msg)
#else
	#define CF_ASSERT(condition, msg) if(!condition) qt_assert(msg, __FILE__, __LINE__);
#endif

#define CF_WORKSPACE_FILE_DESC		"CocosFactory Workspace Files"
#define CF_WORKSPACE_FILE_EXT		"cfw"
#define CF_WORKSPACE_FILE_FILTER	CF_WORKSPACE_FILE_DESC "(*." CF_WORKSPACE_FILE_EXT ")"

#define CF_WORKSPACE_URI			"http://www.cocosfactory.com/workspace"
#define CF_WORKSPACE_NS				"cfw"

#define CF_SCENE_FILE_DESC			"CocosFactory Scene UI Files"
#define CF_SCENE_FILE_EXT			"cfsui"
#define CF_SCENE_FILE_FILTER		CF_SCENE_FILE_DESC "(*." CF_SCENE_FILE_EXT ")"

#define CF_TAG_COCOSFACTORY			"CocosFactory"
#define CF_TAG_WORKSPACE			"Workspace"
#define CF_TAG_PROJECT				"Project"
#define CF_TAG_SCENE_GROUP			"Scenes"
#define CF_TAG_SCENE				"Scene"

#define CF_ATTR_NAME				"name"
#define CF_ATTR_VERSION				"version"
#define CF_ATTR_FILE				"file"

#define CF_XPATH_COCOSFACTORY		"/" CF_TAG_COCOSFACTORY
#define CF_XPATH_WORKSPACE			CF_XPATH_COCOSFACTORY "/" CF_WORKSPACE_NS ":" CF_TAG_WORKSPACE
#define CF_XPATH_PROJECT			CF_XPATH_WORKSPACE "/" CF_WORKSPACE_NS ":" CF_TAG_PROJECT
#define CF_XPATH_SCENE_GROUP		CF_XPATH_PROJECT "/" CF_WORKSPACE_NS ":" CF_TAG_SCENE_GROUP
#define CF_XPATH_SCENE				CF_XPATH_SCENE_GROUP "/" CF_WORKSPACE_NS ":" CF_TAG_SCENE

enum CF_UpdatedReason {
	NEW_WORKSPACE = 0,	// name: Workspace Name
	OPEN_WORKSPACE,		// name: Workspace Name
	NEW_SCENE			// name: Scene Name
};

class CF_NewWorkspaceContext : public CL_UpdatedContext
{
public:
	CF_NewWorkspaceContext(const QString& name) : CL_UpdatedContext(CF_UpdatedReason::NEW_WORKSPACE), m_name(name) {}
	const QString& name() const { return m_name; }
protected:
	QString m_name;
};

class CF_OpenWorkspaceContext : public CL_UpdatedContext
{
public:
	CF_OpenWorkspaceContext(const QString& name) : CL_UpdatedContext(CF_UpdatedReason::OPEN_WORKSPACE), m_name(name) {}
	const QString& name() const { return m_name; }
protected:
	QString m_name;
};

class CF_NewSceneContext : public CL_UpdatedContext
{
public:
	CF_NewSceneContext(const QString& name) : CL_UpdatedContext(CF_UpdatedReason::NEW_SCENE), m_name(name) {}
	const QString& name() const { return m_name; }
protected:
	QString m_name;
};

#endif // CF_DEFINITIONS_H